package pl.edu.agh.bd2.domain;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;

@Entity
@Table(name="grade")
public class Grade {
	
	@Id
	@GeneratedValue
	@NotNull
	private long id;
	
	@Column(name="grade")	
	private double grade;
	
	@Column(name="_date")
	@Temporal(TemporalType.DATE)
	private Date date;
	
	@ManyToOne
	@JoinColumn(name="gradetype")
	private GradeType gradeType;
	
	@ManyToOne
	@JoinColumn(name="student")
	private Student student;
	
	protected Grade() {
	}

	public Grade(double grade, Date date, GradeType gradeType, Student student) {
		super();
		this.grade = grade;
		this.date = date;
		this.gradeType = gradeType;
		this.student = student;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public double getGrade() {
		return grade;
	}

	public void setGrade(double grade) {
		this.grade = grade;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public GradeType getGradeType() {
		return gradeType;
	}

	public void setGradeType(GradeType gradeType) {
		this.gradeType = gradeType;
	}

	public Student getStudent() {
		return student;
	}

	public void setStudent(Student student) {
		this.student = student;
	}
}